<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
  <tr>
    <td bgcolor="#cccccc" width="200" valign="top"><!-- variable RHS Menu -->
      <?php 
	if($_SESSION['user_groups_id']=="2")
	{
		require('templates/menu2.php');
	}
	elseif($_SESSION['user_groups_id']=="6")
	{
		require('templates/menu6.php');
	}	
	else
	{
		require('templates/menu7.php');
	}
	
?>
	  </td>
    <td valign="top" style="padding:30px 30px 30px 30px;">
	<table border="0" width="420" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px">
       <tr>
           <td><img src="heading/Request-Accessories_03.jpg" /></td>
       </tr>
        
		<tr>
		<td>
		<b><div id="resultshere1" class="errorText">
		<?php
	 if($_REQUEST['aexit']==1)
	{
	echo 'User already exist';
	}
	 ?>
	 	<?php
	 if($_REQUEST['nexit']==1)
	{
	echo 'User not found in records';
	}
	 ?>
	 	<?php
	 if($_REQUEST['v']=='success')
	{
	echo 'Your Request has been submitted';
	}
echo '<br>';
 if($_REQUEST['mess']=='success')
       {
       echo 'You request is before warranty';
       }
	 ?>
		</div></b>
		</td>
		</tr>
		<tr>
		<td>
		<form name="requestType" action="request_accessories_type.php" method="post">
		<table border="0">
		<tr>
          <td><b>Request Type:</b>
            <select size="1" name="request_type" id="request_type">
              <option value="0">Select</option>
              <option selected="selected" value="1" <?php echo $indsel;?>>Indiviual</option>
<!--              <option value="2" <?php echo $grpsel;?>>Group</option>
-->            </select>
          </td>
          <td><b>Employee Type:</b>
            <select size="1" name="employee_type" id="employee_type">
              <option value="0">Select</option>
              <option value="1" <?php echo $newsel;?>>New</option>
              <option value="2" <?php echo $oldsel;?>>Old</option>
            </select>
          </td>
          <td><input type="submit" value="Go" class="submit-butt" name="search" id="search" onClick="return recordSearch(this.form);"/></td>
		  </tr>
		  </table>
		  </form>
		  </td>
        </tr>
        <tr>
          <td colspan="3" height="20"></td>
        </tr>
        <tr>
          <td colspan="3">
		 <form name="frmRequestAccessories" id="frmRequestAccessories" method="post" action="requestaccessories_process.php">
		  <table class="grid" border="0" width="400">		  
		      <?php if($_REQUEST['action']=='ind_new'){ ?>
			  <tr>
                <td width="144px"><b>Depot Location</b></td>
                <!--php code here -->
                <td>:</td>
                <td><?php echo GetAccDepotLocation();?>
                </td>
              </tr>
			  <tr>
                <td><b>Employee No</b></td>
                <td>:</td>
                <td><input type="text" name="empno" id="empno" size="20"></td>
              </tr>
              <tr>
                <td><b>Employee Firstname</b></td>
                <td>:</td>
                <td><input name="emp_fname" id="emp_fname" type="text" size="20"></td>
              </tr>
              <tr>
                <td><b>Employee Lastname</b></td>
                <!--php code here -->
                <td>:</td>
                <td><input name="emp_lname" id="emp_lname" type="text" size="20">
                </td>
              </tr>
			  
			  
			   <tr>
                <td><b>Employee Designation</b></td>
                <!--php code here -->
                <td>:</td>
                <td><?php echo GetEmpDesignationName();?>
                </td>
              </tr>
			  
			  <tr>
                <td><b>Date Of Joinning</b></td>
                <!--php code here -->
                <td>:</td>
                <td><input  type="text" id="docgadate" name="docgadate" value="" readonly="readonly" size="15"/>
                  &nbsp;<img src="images/icon_calendar.png" id="icon_calendargdate" width="20" height="17" alt="Calendar" border="0" align="absmiddle" onMouseOver="CalCalender('docgadate','icon_calendargdate')" /> &nbsp;<small>(dd-mm-yyyy)</small>&nbsp;&nbsp;<span style="color:#FF0000"></span>
                </td>
              </tr>
			  
			  
		     <tr>
                <td><b>Employee Address</b></td>
                <td>:</td>
                <td><input type="text" name="emp_address" id="emp_address" size="20"></td>
              </tr>
              <tr>
                <td><b>Employee Telephone</b></td>
                <td>:</td>
                <td><input type="text" name="emp_telno" id="emp_telno" size="20" onKeyPress="return phoneValue(event)"></td>
              </tr>
			  <tr>
                <td><b>Employee Email Address</b></td>
                <td>:</td>
                <td><input name="emp_email" id="emp_email" type="text" size="20"></td>
              </tr>			  			  
 			   <tr>
                <td><b>Accessories Name</b></td>
                <td>:</td>
                <td><?php echo GetAccessoriesData();?></td>
              </tr>
			  
			   <tr>
                <td><b>Data Card</b></td>
                <td>:</td>
                <td><?php echo GetAccCompanyName();?></td>
              </tr>
			   <tr>
                <td><b>Division</b></td>
                <td>:</td>
                <td><?php echo GetDivisionName();?></td>
              </tr>
              <tr>
                <td><b>Region</b></td>
                <td>:</td>
                <td><input type="text" name="region" id="region" size="20"></td>
              </tr>
               <tr>
                <td><b>Reporting to Depot</b></td>
                <!--php code here -->
                <td>:</td>
                <td><?php echo GetDepot();?>
                </td>
              </tr>
              <tr>
                <td><b>Dispatch To Depot</b></td>
                <td>:</td>
                <td><?php echo GetDispatchLocation();?></td>
              </tr>
			  <tr>
                <td><b>Dispatch Location Address</b></td>
                <td>:</td>
                <td><input type="text" name="dispatch_location_address" id="dispatch_location_address" size="20"></td>
              </tr>
                
       			  <input type="hidden" value="1" id="indnew" name="indnew" />
			  <?php }
			  elseif($_REQUEST['action']=='ind_old'){
			  
				$sql = mysql_query('SELECT usr.user_no,usr.user_firstname,usr.user_lastname,lpt.division,lpt.laptopmodel,lpt.region,usr.depot,lpt.dispatch_location,lpt.laptop_id,lpt.dispatch_location_add FROM users as usr INNER JOIN  laptop as lpt ON  usr.user_id = lpt.user_id where usr.user_no="'.$_REQUEST['emp_no'].'"');
				 $result = mysql_fetch_array($sql);
				 ?>			  
			  <tr>
                <td><b>Employee No</b></td>
                <td>:</td>
                <td><input name="emp_oldno" id="emp_oldno" value="<?php echo $_REQUEST['emp_no'];?>" type="text" size="20" onchange="getData(this.value);"></td>
              </tr>
              <tr>
                <td><b>Employee Name</b></td>
                <td>:</td>
                <td><input name="emp_fname" id="emp_fname" type="text" size="20" value="<?php echo $result['user_firstname'].'&nbsp;'.$result['user_lastname'];?>"></td>
              </tr>
			  <tr>
                <td width="144px"><b>Depot Location</b></td>
                <!--php code here -->
                <td>:</td>
                <td><?php echo GetAccDepotLocation();?>
                </td>
              </tr> 
			   <tr>
                <td><b>Accessories Name</b></td>
                <td>:</td>
                <td><?php echo GetAccessoriesData();?></td>
              </tr>
			  
			   <tr>
                <td><b>Data Card</b></td>
                <td>:</td>
                <td><?php echo GetAccCompanyName();?></td>
              </tr>
			  
			  
			   <tr>
                <td><b>Division</b></td>
                <td>:</td>
                <td><?php echo GetDivisionName($result['division']);?></td>
              </tr>
              <tr>
                <td><b>Region</b></td>
                <td>:</td>
                <td><input type="text" name="region" value="<?php echo $result['region'];?>" id="region" size="20"></td>
              </tr>
               <tr>
                <td><b>Reporting to Depot</b></td>
                <!--php code here -->
                <td>:</td>
                <td><?php echo GetDepot($result['depot']);?>
                </td>
              </tr>
              <tr>
                <td><b>Dispatch To Depot</b></td>
                <td>:</td>
                <td><?php echo GetDispatchLocation($result['dispatch_location']);?></td>
              </tr>
			  <tr>
                <td><b>Dispatch Location Address</b></td>
                <td>:</td>
                <td><input type="text" name="dispatch_location_address" id="dispatch_location_address" value="<?php echo $result['dispatch_location_add'];?>" size="20"></td>
              </tr>
             
			   <input type="hidden" value="2" id="indnew" name="indnew" />

                 <?php }
			  elseif($_REQUEST['action']=='grp_new'){
			   ?>
			         <tr>
                <td><b>Employee No</b></td>
                <td>:</td>
                <td><input type="text" name="empno0" id="empno0" size="20"></td>
              </tr>
              <tr>
                <td><b>Employee Firstname</b></td>
                <td>:</td>
                <td><input name="emp_fname0" id="emp_fname0" type="text" size="20"></td>
              </tr>
              <tr>
                <td><b>Employee Lastname</b></td>
                <!--php code here -->
                <td>:</td>
                <td><input name="emp_lname0" id="emp_lname0" type="text" size="20">
                </td>
              </tr>
			  
			   
			   <tr>
                <td><b>Employee Designation</b></td>
                <!--php code here -->
                <td>:</td>
                <td><input name="emp_desn0" id="emp_desn0" type="text" size="20">
                </td>
              </tr>
			  
		     <tr>
                <td><b>Employee Address</b></td>
                <td>:</td>
                <td><input type="text" name="emp_address0" id="emp_address0" size="20"></td>
              </tr>
              <tr>
                <td><b>Employee Telephone</b></td>
                <td>:</td>
                <td><input type="text" name="emp_telno0" id="emp_telno0" size="20" onKeyPress="return phoneValue(event)"></td>
              </tr>
			  <tr>
                <td><b>Employee Email Address</b></td>
                <td>:</td>
                <td><input name="emp_email0" id="emp_email0" type="text" size="20"></td>
              </tr>
			  			  
			   <tr>
			   <td colspan="3">&nbsp;</td>
			   </tr>
			   <tr>
			   <td colspan="3"><div id="myDiv"> </div></td>
			   </tr>
			   <tr>
			   <td colspan="3">&nbsp;</td>
			   </tr>
			   <input type="hidden" value="0" name="grpemp" id="grpemp" />

			   
			   <input type="hidden" value="0" id="theValue" />
<p><a href="javascript:;" onclick="addElement();">Add More Employees</a></p>

			   
			    <tr>
                <td><b>Accessories Name</b></td>
                <td>:</td>
                <td><?php echo GetAccessoriesData();?></td>
              </tr>
			  
			   <tr>
                <td><b>Company Name</b></td>
                <td>:</td>
                <td><?php echo GetAccCompanyName();?></td>
              </tr>
			   
			   <tr>
                <td><b>Division</b></td>
                <td>:</td>
                <td><?php echo GetDivisionName();?></td>
              </tr>
              <tr>
                <td><b>Region</b></td>
                <td>:</td>
                <td><input type="text" name="region" id="region" size="20"></td>
              </tr>
             
              <tr>
                <td><b>Reporting to Depot</b></td>
                <!--php code here -->
                <td>:</td>
                <td><?php echo GetDepot();?>
                </td>
              </tr>
              <tr>
                <td><b>Dispatch To Depot</b></td>
                <td>:</td>
                <td><?php echo GetDispatchLocation();?></td>
              </tr>
			  <tr>
                <td><b>Dispatch Location Address</b></td>
                <td>:</td>
                <td><input type="text" name="dispatch_location_address" id="dispatch_location_address" size="20"></td>
              </tr>
             
			  <input type="hidden" value="3" id="indnew" name="indnew" />
			  
			   
               <?php }
			  elseif($_REQUEST['action']=='grp_old'){
			   ?>
			   
			  <tr>
                <td width="144px"><b>Depot Location</b></td>
                <!--php code here -->
                <td>:</td>
                <td><?php echo GetAccDepotLocation();?>
                </td>
              </tr> 
			  <tr>
                <td><b>Employee No</b></td>
                <td>:</td>
                <td><input name="emp_oldno0" id="emp_oldno0" type="text" size="20"></td>
              </tr>
			   <tr>
			   <td colspan="3"><div id="myDiv1"> </div></td>
			   </tr>
			   
			   
			   			   <input type="hidden" value="0" name="grpemp" id="grpemp" />
						   
				 <tr>
                <td><b>Accessories Name</b></td>
                <td>:</td>
                <td><?php echo GetAccessoriesData();?></td>
              </tr>
			  
			   <tr>
                <td><b>Company Name</b></td>
                <td>:</td>
                <td><?php echo GetAccCompanyName();?></td>
              </tr>		   

			   
			   <tr>
                <td><b>Division</b></td>
                <td>:</td>
                <td><?php echo GetDivisionName();?></td>
              </tr>
              <tr>
                <td><b>Region</b></td>
                <td>:</td>
                <td><input type="text" name="region" id="region" size="20"></td>
              </tr>
               <tr>
                <td><b>Reporting to Depot</b></td>
                <!--php code here -->
                <td>:</td>
                <td><select size="1" name="depot" id="depot">
                    <option value="0" selected="selected">Select</option>
                    <option value="depot">depot</option>
                  </select>
                </td>
              </tr>
              <tr>
                <td><b>Dispatch To Depot</b></td>
                <td>:</td>
                <td><?php echo GetDispatchLocation();?></td>
              </tr>
			  <tr>
                <td><b>Dispatch Location Address</b></td>
                <td>:</td>
                <td><input type="text" name="dispatch_location_address" id="dispatch_location_address" size="20"></td>
              </tr>
             			  
			   			  <input type="hidden" value="4" id="indnew" name="indnew" />
			   
			     <input type="hidden" value="0" id="theValue1" />
<p><a href="javascript:;" onclick="addOldElement();">Add More Employees</a></p>



			  <?php }
			  else{/*
			   ?>
			   
			    <tr>
                <td><b>Accessories Name</b></td>
                <td>:</td>
                <td><?php echo GetAccessoriesData();?></td>
              </tr>
			  
			   <tr>
                <td><b>Data Card</b></td>
                <td>:</td>
                <td><?php echo GetAccCompanyName();?></td>
              </tr>
			   <tr>
                <td><b>Division</b></td>
                <td>:</td>
                <td><?php echo GetDivisionName();?></td>
              </tr>
              <tr>
                <td><b>Region</b></td>
                <td>:</td>
                <td><input type="text" name="region" id="region" size="20"></td>
              </tr>
             
              <tr>
                <td><b>Depot</b></td>
                <!--php code here -->
                <td>:</td>
                <td><?php echo GetDepot();?>
                </td>
              </tr>
              <tr>
                <td><b>Dispatch Location</b></td>
                <td>:</td>
                <td><input type="text" name="dispatch_location" id="dispatch_location" size="20"></td>
              </tr>
              <tr>
                <td><b>Dispatch Date</b></td>
                <td>:</td>
                <td><input  type="text" id="doc3" name="doc3" value="" readonly="readonly" size="15"/>
                  &nbsp;<img src="images/icon_calendar.png" id="icon_calendar1" width="20" height="17" alt="Calendar" border="0" align="absmiddle" onMouseOver="CalCalender('doc3','icon_calendar1')" /> &nbsp;<small>(dd-mm-yyyy)</small>&nbsp;&nbsp;</td>
              </tr>*/
			  ?>
			  <input type="hidden" value="0" id="indnew" name="indnew" />
			  <?php } ?>
			  
			   
              
              <!--add javascript date here-->
              <tr>
                <td colspan="3" align="center">
				<input type="hidden" name="PageName" value="<?php echo $_SERVER['REQUEST_URI'];?>" />
				<input type="submit" value="Submit" name="submit" onClick="return Validate_Accessories_Request_Type('frmRequestAccessories');"></td>
              </tr>
            </table>
			</form>
			</td>
        </tr>
      </table></td>
  </tr>
</table>
<script type="text/javascript">
function addElement() {
  var ni = document.getElementById('myDiv');
  var numi = document.getElementById('theValue');
  var num = (document.getElementById('theValue').value -1)+ 2;
  numi.value = num;
  var newdiv = document.createElement('div');
  var divIdName = 'my'+num+'Div';
  newdiv.setAttribute('id',divIdName);
  newdiv.innerHTML = '<table border="0" class="grid1"><tr><td><b>Employee No</b></td><td>:</td><td><input type="text" name="empno'+num+'" id="empno'+num+'" size="20"></td></tr><tr><td><b>Employee Firstname</b></td><td>:</td><td><input name="emp_fname'+num+'" id="emp_fname'+num+'" type="text" size="20"></td></tr><tr><td><b>Employee Lastname</b></td><td>:</td><td><input name="emp_lname'+num+'" id="emp_lname'+num+'" type="text" size="20"></td></tr><tr><td><b>Employee Designation</b></td><td>:</td><td><input name="emp_desn'+num+'" id="emp_desn'+num+'" type="text" size="20"></td></tr><tr><td><b>Employee Address</b></td><td>:</td><td><input type="text" name="emp_address'+num+'" id="emp_address'+num+'" size="20"></td></tr><tr><td><b>Employee Telephone</b></td><td>:</td><td><input type="text" name="emp_telno'+num+'" id="emp_telno'+num+'" size="20" onKeyPress="return phoneValue(event)"></td></tr><tr><td><b>Employee Email Address</b></td><td>:</td><td><input name="emp_email'+num+'" id="emp_email'+num+'" type="text" size="20"><input type="hidden" value="'+num+'" name="addgrpemp" id="addgrpemp" /><input type="hidden" value="'+num+'" name="grpemp" id="grpemp" /></td></tr></table><br><br>';
  ni.appendChild(newdiv);
}

function removeElement(divNum) {
var d = document.getElementById('myDiv');
d.removeChild(divNum);
}
</script>

<script type="text/javascript">
function addOldElement() {
  var ni = document.getElementById('myDiv1');
  var numi = document.getElementById('theValue1');
  var num = (document.getElementById('theValue1').value -1)+ 2;
  numi.value = num;
  var newdiv = document.createElement('div');
  var divIdName = 'my'+num+'Div';
  newdiv.setAttribute('id',divIdName);
  newdiv.innerHTML = '<table border="0" cellpadding="0" cellspacing="0" class="grid1"><tr><td><b>Enter Employee Number</b></td><td>&nbsp;:</td><td>&nbsp;<input name="emp_oldno'+num+'" id="emp_oldno'+num+'" type="text" size="20"></td></tr><input type="hidden" value="'+num+'" name="addgrpemp" id="addgrpemp" /><input type="hidden" value="'+num+'" name="grpemp" id="grpemp" /></table><br>';
  ni.appendChild(newdiv);
}

function removeElement(divNum) {
var d = document.getElementById('myDiv1');
d.removeChild(divNum);
}


function getData(value)
{
document.location.href = "request_accessories.php?action=ind_old&emp_no="+value+"";
document.getElementByID('emp_oldno').value = trim(value);
}
</script>